/** \file    io_legacy.cpp
  * \brief   Defines several io functions for old (legacy) applications.
  * \date    2003
  * \author  Fedor Chelnokov
  * \version $Header: /home/cscom1r4/cvsroot/cs/imglib/src/io_legacy.cpp,v 1.1 2004/02/04 14:43:23 cscom1r4 Exp $
  */

#include "imglib/io_legacy.h"

namespace img {

size_point ping(const std::string & filename)
{
	our_qt_im_multireader r;
	file_info i;
	if (r.ping(filename, &i))
		return size_point(i.dim.sx, i.dim.sy);
	throw io_error("unknown image format", filename);
}

void read(const std::string & filename, byte_image & img)
{
	our_qt_im_multireader r;
	r.read(filename, img);
}

void write(const std::string & filename, const byte_image & img, const std::string & format, bool alpha)
{
	our_qt_im_multiwriter().write(filename, format, img, alpha);
}

void formats(ext_vec & f, format_type)
{
	our_qt_im_multireader r;
	//!attention: only decodable formats, format_type is ignored for a while
	r.formats(f);
}

std::string search_str(format_type)
{
	our_qt_im_multireader r;
	//!attention: only decodable formats, format_type is ignored for a while
	return r.search_str();
}

} //namespace img
